package lab02.test06;

/**
 * Created by JAVA on 2017/10/15.
 */
public class Triangle {//Triangle类具有类型为double的三个边，以及周长、面积属性，Triangle类具有返回周长、面积以及修改三个边的功能。
    // 另外，Triangle类还具有一个Boolean型的属性，该属性用来判断三个属能否构成一个三角形。
    private double a, b, c;
    private boolean temp;
    private double area,girth;
    public Triangle(){};
    public Triangle(double a,double b,double c,boolean temp,double area,double girth){
        this.a=a;
        this.b=b;
        this.c=c;
        this.temp=temp;
        this.area=area;
        this.girth=girth;
    }

    public double getArea(double a,double b,double c) {
        double s=(a+b+c)/2;
        double x=s*(s-a)*(s-b)*(s-c);
        area=(double) Math.sqrt(x);
        return area;
    }
    public void setArea(double area) {
        this.area = area;
    }
    public double getPerimeter(double a,double b,double c) {
        girth=a+b+c;
        return girth;
    }
    public void setPerimeter(double girth) {
        this.girth = girth;
    }
    public double getA() {
        return a;
    }
    public void setA(double a) {
        this.a = a;
    }
    public double getB() {
        return b;
    }
    public void setB(double b) {
        this.b = b;
    }
    public double getC() {
        return c;
    }
    public void setC(double c) {
        this.c = c;
    }
    public boolean isTemp(double a,double b,double c) {
        if (a*a==b*b+c*c||b*b==a*a+c*c||c*c==a*a+b*b){
            temp=true;
        }else{
            System.out.println("不能构成三角形！");
        }
        return temp;
    }
    public void setTemp(boolean temp) {
        this.temp = temp;
    }

}
